package com.worldvision.test;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.logging.Logger;

import org.openqa.selenium.By;
import org.testng.annotations.Test;


import com.worldvision.main.page.home.HomePage;
import com.worldvision.main.page.member.MyNextPaymentPage;
import com.worldvision.main.page.member.MyProfilePage;
import com.worldvision.main.page.member.PasswordChangePage;
import com.worldvision.main.Report.testReporter;
import com.worldvision.main.page.member.SearchPaymentPage;
import com.worldvision.main.reg.RegPage;
import com.worldvision.main.util.Report;
import com.worldvision.main.util.UTIL;

public class memberPageTestExtn extends abstractTest
{
	
	static Map<String,String> map = new HashMap<String,String>()
			{
				{
					put("MobileNumber","07581358184");
					put("partnerId","1105623");
					put("fullname","Sriram Angajala");
					put("address","Manchester, M80NL");
				}
			};
	static Map<String,String> editProfileData = new HashMap<String,String>()
			{
				{
					put("FName","Sriram");
				put("LName","Angajala");
				put("Title","label=Mrs.");
				put("FName","test1");
				put("LName","te");
				put("Add1","Test");
				put("Add2","Test");
				put("Add3","Manchester, M80NL");
				put("FC","label=Other Passport Holder");
				put("Ctry","label=Azerbaijan");
				put("State","kent");
				put("City","Lancshire");
				put("PIN","m80nl");
				put("Mobile","075813581844");
				put("Tel_R","121212");
				put("Tel_O","121212");
				put("Fax","121212");
				//put("BirthDate","1981-01-13");
				
				
			}
		};
	static Map<String,String> regData = new HashMap<String,String>()
				{
					{
						
					//put("Email","sriram.angajala1@gmail.com");
					put("nPasswdRe","test12");
					put("nPasswd","test12");
					put("FName","Sriram");
					put("LName","Angajala");
					put("Title","label=Mrs.");
					put("FName","test1");
					put("LName","te");
					put("Add1","Test");
					put("Add2","Test");
					put("Add3","Manchester, M80NL");
					//put("FC","label=Other Passport Holder");
					//put("Ctry","label=Azerbaijan");
					put("State","label=Andhra Pradesh");
					put("City","Lancshire");
					put("PIN","m80nl");
					put("Mobile","075813581844");
					put("Tel_R","121212");
					put("Tel_O","121212");
					put("Fax","121212");
					put("radio=FC","FC");
					//put("BirthDate","1981-01-13");
					
					
				}
			};
	static Map<String,String> changePasswordData = new HashMap<String,String>()
					{
						{
							
						put("nPasswd","test123");
						put("nPasswdRe","test123");
						
					}
				};
	static Map<String,String> PAYMENT = new HashMap<String,String>()
			{
		{
			put("PayMonth","1 Month");
			put("PayMonth2","2 Months");
			put("PayAmount","800");
			put("PayAmount2","1600");
			put("TotalAmount2","2400");
		}
		
			};
//	@Test(groups="Acceptance")
	public void checkPayment() throws IOException
	{
		Report.addNewIteration("checkPayment");
		HomePage homePage = new HomePage(driver);
		
		MyProfilePage myProfilePage = homePage.checkAndLogin(HomePageTest.map.get("username"), HomePageTest.map.get("partnerId"));
		MyNextPaymentPage myPaymentPage = myProfilePage.goToMyNextPaymentPage();
		myPaymentPage.addSponser(PAYMENT.get("PayMonth"), PAYMENT.get("PayAmount"));
		myProfilePage.logout();
	}
	@Test
	public void checkMultiPayment() throws IOException
	{
		Report.addNewIteration("checkPayment");
		HomePage homePage = new HomePage(driver);
		
		MyProfilePage myProfilePage = homePage.checkAndLogin(HomePageTest.map.get("username"), HomePageTest.map.get("partnerId"));
		MyNextPaymentPage myPaymentPage = myProfilePage.goToMyNextPaymentPage();
		myPaymentPage.addPayRow(1,PAYMENT.get("PayMonth"));
		myPaymentPage.checkSponserRowAmount(1,PAYMENT.get("PayAmount"));
		myPaymentPage.checkSponserTotals(PAYMENT.get("PayAmount"),PAYMENT.get("PayAmount"));
		//myPaymentPage.addSponser(PAYMENT.get("PayMonth"), PAYMENT.get("PayAmount"));
		myPaymentPage.addPayRow(2,PAYMENT.get("PayMonth2"));
		myPaymentPage.checkSponserRowAmount(2,PAYMENT.get("PayAmount2"));
		myPaymentPage.checkSponserTotals(PAYMENT.get("TotalAmount2"),PAYMENT.get("TotalAmount2"));
		myPaymentPage.submitPayment();
		myPaymentPage.checkRowPaymentPage(1, PAYMENT.get("PayAmount"), PAYMENT.get("TotalAmount2"));
		myPaymentPage.checkRowPaymentPage(2, PAYMENT.get("PayAmount2"), PAYMENT.get("TotalAmount2"));
		myProfilePage.logout();
	}
	
	
}
//Testcases
//login
//login cancel
//sponser child save
//sponser child cancel
/*My Profile
	view profile
	view after update profile
	upgrade payment

Search payment history
	search with invalid dates
	seach with valid dates
	search with valid but no resutls page
Edit profile
	update 
	cancel
Chnage Password
	change password
	cancel change password*/

//Tell a friend
//My next payment
	
